Conversation
|
I can understand not wanting to break installs for existing users, but I'm a little uneasy about introducing a new supply chain risk by relying on a third party to re-upload protoc to crates.io. I wonder if we could avoid requiring protoc when installing this crate by storing the generated Rust structs in source control. In other projects we do this by overriding the let out_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/src");
unsafe { env::set_var("OUT_DIR", &out_dir) };That can be combined with an envvar check to only compile the protobuf if protoc is installed: if env::var("PROTOC").is_ok() {
prost_build::compile_protos(...)?;
} else {
println!("protoc not found, skipping protobuf generation");
} |
thanks for the review! I removed the dependency. I am not sure 100% if my solution is what you had in mind though since I simply added also added a custom env var check. |
|
Yeah, that's roughly what I was thinking. But it looks like CI needs fixing (unrelated to your change)
|
|
I'm not sure where the |
I think it's something they invented. this env var was never set for me. I replaced it with a |
|
Looks good! There's just one more failure because of the |
ahh missed that - fixed! 🙏🏼 |
seanlinsley
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
|
|
||
| prost_build::compile_protos(&[&out_protobuf_path.join(LIBRARY_NAME).with_extension("proto")], &[&out_protobuf_path])?; | ||
|
|
||
| std::fs::rename(src_dir.join("pg_query.rs"), src_dir.join("protobuf.rs"))?; |
There was a problem hiding this comment.
It seems like this line broke the docs.rs build https://docs.rs/crate/pg_query/6.1.0/builds/1945029
There was a problem hiding this comment.
Maybe we should detect the DOCS_RS envvar like polywrap/rust-wrap-client#245 does
upgrade prost to latest to fix gnu builds. tested it locally via docker. I think the only relevant breaking change is that
protocneeds to be available in the path now. to not break anything for consumers of this library, I added theprotoc-bin-vendoredcrate.Breaking Changes from the Changelog
v13
TryFrom<i32>for enums tokio-rs/prost#1010)v12
None?
v11